package com.jingdun.sport.bean.model;


import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.io.Serializable;

/**
 * 接口返回格式
 *
 * @author powell
 * @since 2020-07-07
 */
@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
public class ApiResult<T> implements Serializable {
    public static ApiResult getInstance() {
        return new ApiResult();
    }

    public ApiResult() {
    }

    public ApiResult(int c, String m, T r) {
        code = c;
        msg = m;
        data = r;
    }

    private int code = 200;
    private String msg = "succeed";
    private T data;

    public int getCode() {
        return code;
    }

    public ApiResult<T> setCode(int code) {
        this.code = code;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public ApiResult<T> setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public T getData() {
        return data;
    }

    public ApiResult<T> setData(T data) {
        this.data = data;
        return this;
    }

}
